package com.dp.prototype.deep_clone;

import java.io.Serializable;

/**
 * @Author: Ruomeng
 * @Date: 2024/11/27
 * @Description : design-pattern
 * 具体的原型类
 * 实现Cloneable标识类接口，表示当前类可以复制
 * @Version: 1.0
 */
public class ConcreteDeepCloneProtoType implements Cloneable, Serializable {

    private Person person;

    public Person getPerson() {
        return person;
    }

    public void setPerson(Person person) {
        this.person = person;
    }

    public ConcreteDeepCloneProtoType() {
        System.out.println("Create ConcreteDeepCloneProtoType Class Success");
    }

    @Override
    public ConcreteDeepCloneProtoType clone() throws CloneNotSupportedException {
        System.out.println("clone Class Copy");
        return (ConcreteDeepCloneProtoType) super.clone();
    }

    public void show() {
        System.out.println("name: " + person.getName());
    }
}
